package cn.richard.demo.ruleengine.config;

import org.jeasy.rules.api.Facts;
import org.jeasy.rules.api.Rule;
import org.jeasy.rules.api.RuleListener;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class MyRuleListener implements RuleListener{

	@Override
	public void onEvaluationError(Rule rule, Facts facts, Exception exception) {
		log.error("onEvaluationError, rule: {}, facts: {}", rule, facts.asMap(), exception);
	}

	@Override
	public void onSuccess(Rule rule, Facts facts) {
		log.info("onSuccess, rule: {}, facts: {}", rule, facts.asMap());
	}

	@Override
	public void onFailure(Rule rule, Facts facts, Exception exception) {
		log.error("onFailure, rule: {}, facts: {}", rule, facts.asMap(), exception);
	}
	
}
